causal inference hw 1

作业内容:

作业1: 将B书6.1.2节(Standardization with a parametric outcome model)的2个案例代码翻译为计算公式,需标明代码与公式的对应关系。 截止时间:10月24日晚上10点

作业2: 查看10.24“需阅读材料”,提前阅读文献,准备当次课讲解文献(无需做ppt)。

B书《Fundamentals of Causal Inference With R (Babette A. Brumback) 》

数据:

https://s3-eu-west-1.amazonaws.com/s3-euw1-ap-pe-ws4-cws-documents.ri-prod/9780367705053/Brumback_FOCI_Website_Material.zip

作业1

作业2

rm(list=ls())
suppressMessages(library(tidyverse))

load('/Users/hcy/Documents/MyKeyData/300hobby/370professional_class_note/PhD_hw/Brumback FOCI Website Material/Chapter 6/simdr.r.RData')

load('/Users/hcy/Documents/MyKeyData/300hobby/370professional_class_note/PhD_hw/Brumback FOCI Website Material/Chapter 6/whatif2dat.RData')

glimpse(whatif2dat)
Rows: 165
Columns: 11
$ vl0      <int> 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0…
$ vlcont0  <int> 20, 20, 61420, 600, 75510, 20, 40, 86200, 20, 20, 20, 20, 657…
$ artad0   <int> 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, NA, 1, 0, 1, 1, NA, 1,…
$ vl4      <int> 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1…
$ vlcont4  <int> 420, 20, 20, 20, 184420, 30, 20, 1480, 20, 20, 100, 20, 59820…
$ artad4   <int> 1, 1, 1, 1, 0, 0, 1, 1, 1, NA, 0, 1, 1, 1, 0, 1, 0, 1, NA, 1,…
$ audit0   <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1…
$ T        <int> 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0…
$ A        <int> 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0…
$ lvlcont0 <dbl> 2.995732, 2.995732, 11.025491, 6.396930, 11.232020, 2.995732,…
$ lvlcont4 <dbl> 6.040255, 2.995732, 2.995732, 2.995732, 12.124971, 3.401197, …